#ifndef CORE_H_
#define CORE_H_

#include "config.h"
#include "master.h"
#include "worker.h"

#include <vector>

class Core
{
private:
    Master m_master;
    std::vector<Worker> m_workers;

    // 私有化构造函数，‌防止外部创建实例
    Core() = default;
    ~Core() = default;
    // 删除拷贝构造函数和赋值运算符，‌防止拷贝
    Core(const Core &) = delete;
    Core &operator=(const Core &) = delete;
    bool m_isRunning;
public:
    static Core &GetInstance();

public:
    bool Init(Config &config);
    bool Start();
    void Run();
    void Stop();

    Master *GetMaster() {
        return &m_master;
    }
    Worker *GetWorker(int index){
        if (index < m_workers.size()) {
            return &m_workers[index];
        }
        return nullptr;        
    }
};

#endif